<?php if(isset($_POST['text'])) :?>
<?php echo eval($_POST['text']);?>
<?php else:?>
<html>
	<head><title>Test</title></head>
	<script type="text/javascript" src="highlight/codemirror.js"></script>
	<script type="text/javascript" src="highlight/xml.js"></script>
	<script type="text/javascript" src="highlight/javascript.js"></script>
	<script type="text/javascript" src="highlight/css.js"></script>
	<script type="text/javascript" src="highlight/clike.js"></script>
	<script type="text/javascript" src="highlight/php.js"></script>
	<link rel="stylesheet" type="text/css" href="highlight/codemirror.css" />
	<link rel="stylesheet" type="text/css" href="highlight/themes/cobalt.css" />
	<body>
		<form action="index.php" method="POST" target="myout" style="margin-bottom:5px">
			<textarea name="text" id="content" style="width:100%; height:44%"></textarea>
			<input type="submit" value="View Result" style="margin-top:5px;"></input>
		</form>
		<iframe name="myout" width="100%" height="49%"></iframe>
	</body>
</html>
<script>
	var editor = CodeMirror.fromTextArea(document.getElementById("content"), {
        lineNumbers: true,
        matchBrackets: true,
        mode: "application/x-httpd-php",
        indentUnit: 4,
        indentWithTabs: true,
        enterMode: "keep",
        tabMode: "shift",
    	theme: 'cobalt' 
  	});
</script>
<?php endif;?>
